package easy.netty.net.core;

import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;

/**
 * @author cengy
 */
public class IoConf
        implements Serializable {

    private static final long serialVersionUID = -130499650604240834L;

    protected String id;
    protected String name;
    protected String desc;
    protected String className;
    protected String ip;
    protected int port;
    protected int bossThreadNum = 1;
    protected int workerThreadNum = 8;
    protected boolean enable = true;
    protected int readIdle = 5 * 60;
    protected int writeIdle = 5 * 60;
    protected int allIdle = 5 * 60;
    protected boolean isAutoConnect = true;
    protected String ws = "ws";
    protected String wsLocation = "/websocket";

    protected Map<String, Object> options = new HashMap<>();

    public boolean isWs() {
        return "ws".equalsIgnoreCase(ws);
    }

    public boolean isWss() {
        return "wss".equalsIgnoreCase(ws);
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

    public int getBossThreadNum() {
        return bossThreadNum;
    }

    public void setBossThreadNum(int bossThreadNum) {
        this.bossThreadNum = bossThreadNum;
    }

    public int getWorkerThreadNum() {
        return workerThreadNum;
    }

    public void setWorkerThreadNum(int workerThreadNum) {
        this.workerThreadNum = workerThreadNum;
    }

    public String getIp() {
        return ip;
    }

    public void setIp(String ip) {
        this.ip = ip;
    }

    public int getPort() {
        return port;
    }

    public void setPort(int port) {
        this.port = port;
    }

    public boolean isEnable() {
        return enable;
    }

    public void setEnable(boolean enable) {
        this.enable = enable;
    }

    public String getClassName() {
        return className;
    }

    public void setClassName(String className) {
        this.className = className;
    }

    public int getReadIdle() {
        return readIdle;
    }

    public void setReadIdle(int readIdle) {
        this.readIdle = readIdle;
    }

    public int getWriteIdle() {
        return writeIdle;
    }

    public void setWriteIdle(int writeIdle) {
        this.writeIdle = writeIdle;
    }

    public int getAllIdle() {
        return allIdle;
    }

    public void setAllIdle(int allIdle) {
        this.allIdle = allIdle;
    }

    public boolean isAutoConnect() {
        return isAutoConnect;
    }

    public void setAutoConnect(boolean autoConnect) {
        isAutoConnect = autoConnect;
    }

    public String getWs() {
        return ws;
    }

    public void setWs(String ws) {
        this.ws = ws;
    }

    public String getWsLocation() {
        return wsLocation;
    }

    public void setWsLocation(String wsLocation) {
        this.wsLocation = wsLocation;
    }

    public Map<String, Object> getOptions() {
        return options;
    }

    public void setOptions(Map<String, Object> options) {
        this.options = new HashMap<>(options);
    }
}
